package com.coolwen.dao;

import com.coolwen.entity.Resource;
import com.coolwen.entity.Role;
import com.coolwen.entity.RoleResource;
import com.coolwen.entity.UserRole;

import java.util.List;

public interface RoleMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Role record);

    int insertSelective(Role record);

    Role selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

    UserRole loadUserRole(long uid, long roleId);

    List<Role> listRole();


//    void addUserRole(long uid,long roleId);
//
//    void deleteUserRole(long uid,long roleId);

    /**
     * 删除某个用户的所有角色
     *
     * @param uid
     */
    public void deleteUserRoles(long uid);

    /**
     * 根据角色id获取可以访问的所有资源
     *
     * @param roleId
     * @return
     */
    public List<Resource> listRoleResource(long roleId);


}